class SearchController < ApplicationController

  def index
    query = params[:q]
    
    @tasks = Task.find(:all, :conditions => "name like '%#{query}%' or keywords like '%#{query}%' or description like '%#{query}%'")

    @users = User.find(:all, :conditions => "name like '%#{query}%' or surname like '%#{query}%' or keywords like '%#{query}%' or email like '%#{query}%'")

    @patterns = Pattern.find(:all, :conditions => "id like '%#{query}%' or title like '%#{query}%'")

    @notes = Note.find(:all, :conditions => "title like '%#{query}%' or body like '%#{query}%'")

    @contacts = Contact.find(:all, :conditions => "name like '%#{query}%' or surname like '%#{query}%' or company like '%#{query}%'")
    
    @documents = Document.find(:all, :conditions => "name like '%#{query}%'")
    
    @projects = Project.find(:all, :conditions => "name like '%#{query}%' or description like '%#{query}%' or abbr like '%#{query}%' or keywords like '%#{query}%'")
        
  end
end